import request from '@/utils/request'
/** 
*获取更新的购物车信息
*@params {String} skuId- skuId
*@returns Promise 
*/
export const getUpdateCart = (skuId) => {
    return request(`/goods/stock/${skuId}`,'get')
}
/**
 * 获取商品的specs和skus
 * @param {String} skuId - 商品SKUID
 * @returns Promise
 */
export const getSpecsAndSkus = (skuId) => {
    return request(`/goods/sku/${skuId}`, 'get')
}
/**
 * 合并购物车
 * @param {Number} skuId --skuId
 * @param {String} selected --是否选中状态
 * @param {String} count --购物车商品的数量
 * @returns Promise
 */
export const mergeCartGoods = (cartList) => {
    return request('/member/cart/merge','post',cartList)
}
/**
 * 获取购物车列表
 * @param {Number} skuId
 * @param {Number} count 
 * @returns Promise
 */
export const getCartList = () => {
    return request('/member/cart','get')
}
/**
 * 加入购物车
 * @param {Number} skuId 
 * @param {NUmber} count  商品数量
 * @returns Promise
 */
export const getAddCart = ({skuId, count}) => {
    return request('/member/cart','post', {skuId, count})
}
/**
 * 删除登录后购物车商品
 * @param {Array<String>} ids --skuId数组集合
 * @returns Promise
 */
export const deleteCartSet = (ids) => {
    return request('/member/cart','delete',{ids})
}
/**
 * 修改商品信息
 * @param {*} params
 * @param skuId
 * @param selected -- 选择
 * @param count -- 数量
 * @returns  Promise
 */
export const selectedCart = ({skuId, selected, count}) => {
    return request(`/member/cart/${skuId}`,'put',{selected, count})
}
/**
 * 全选与取消选择
 * @param {} param0 
 * @returns 
 */
export const setCartGoods = ({ selected}) => {
    return request('/member/cart/selected','put',{ selected })
}